
//滚动加载
function load() {
    var dropload = $('#box').dropload({
        scrollArea: window,
        domDown: {
            domClass: 'dropload-down',
            domRefresh: '<div class="dropload-refresh">上拉加载更多</div>',
            domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
            domNoData: '<div class="dropload-noData">已无数据</div>'
        },
        loadDownFn: function (me) {

            getList(function (data) {
                if (data.length == 0) {
                    me.resetload();
                    me.lock();
                    me.noData();
                    me.resetload();
                    return;
                } else {
                    var result = init(data);
                    $('.dealtList').append(result);
                }
                me.resetload();
            });
        }
    });
}
//日期转换
function changeData(time) {
    time = new Date(parseInt(time) * 1000);
    var year = time.getFullYear() + '年';
    var month = time.getMonth() + 1 + '月';
    var date = time.getDate() + '日 ';
    var hour = time.getHours() + '时';
    return [year, month, date, hour].join('');
}
//页面渲染
function init(data) {
    var list = "";
    for (var i = 0; i < data.length; i++) {
        list += '    <li data-id="'+data[i].pk_id+'" data-stage="'+data[i].stage+'">';
        list += '      <div class="top">';
        list += '         <p>' + data[i].name + '</p>';
        list += '         <p class="time">';
        list += '           <span>' + data[i].create_time + '</span>';
        list += '         </p>';
        list += '         <p class="carNumber">';
        list += '           <span class="color">车牌：</span>';
        list += '           <span>' + data[i].query_car_no + '</span>';
        list += '         </p>';
        list += '         <p class="listTime">';
        list += '           <span class="color">时间：</span>';
        list += '           <span>' + changeData(data[i].query_datetime) + '</span>';
        list += '         </p>';
        list += '      </div>';
        list += '      <div class="bottom">';
        list += '         <span' + ((data[i].stage == 1 ) ? ">待查询" : ((data[i].stage == 2) ? " class='blue'>已完成" : ">查询失败")) + '</span>';
        list += '      </div>';
    }
    return list;

}
